<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>收货日对账</title>
    <link rel="stylesheet" href="/3nod_web/layui/css/layui.css" media="all">
</head>
<body>
<div id="content">
    <h1>收货日对账</h1>
    <div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">起始时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="startTime" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">结束时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="endTime" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <button id="search" class="layui-btn layui-btn-sm" data-type="reload">搜索</button>
            </div>
            <div class="layui-inline">
                <a href="/3nod_web/exportReconciliation">
                    <button class="layui-btn layui-btn layui-btn-sm">导出</button>
                </a>
            </div>
        </div>
    </div>

</div>
<table class="layui-hide" id="demo" lay-filter="demo"></table>
<script src="/3nod_web/layui/layui.js" charset="utf-8"></script>
<script src="/3nod_web/js/jquery-1.8.3.js" charset="utf-8"></script>
<script>
    layui.use('table', function () {
        var table = layui.table;

        //方法级渲染
        table.render({
            elem: '#demo'
            , url: '/3nod_web/report/reconciliationList/'
            , cellMinWidth: 150
            , cols: [
                [

                    {field: 'receiptKey', title: 'ASN/收货单',fixed: true}
                    , {field: 'sku', title: '物料编码', sort: true, width: 150}
                    , {field: 'externreceiptkey', title: '外部收货单', sort: true, width: 150}
                    , {field: 'dateReceived', title: '日期', width: 150}
                    , {field: 'status', title: '状态'}
                    , {field: 'lottable01', title: '批属性1'}
                    , {field: 'qtyexpected', title: '预期量汇总'}
                    , {field: 'qtyreceived', title: '接受量汇总'}
                ]
            ]
            , id: 'testReload'
            , page: true
            , height: 'full-90'
            , limits: [20, 50, 100, 200, 500, 1000, 2000, 3000, 4000, 5000]
            , limit: 20
        })

        var $ = layui.$, active = {
            reload: function () {
                var startTime = $('[name=startTime]');
                var endTime = $('[name=endTime]');

                //执行重载
                table.reload('testReload', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    , where: {
                        startTime: startTime.val(),
                        endTime: endTime.val()
                    }
                }, 'data');
            }
        };

        $('#search').on('click', function () {
            active['reload'] ? active['reload'].call(this) : '';
        });
        //按回车提交
        $(".layui-input-inline").keydown(function (e) {//当按下按键时
            if (e.which == 13) {//.which属性判断按下的是哪个键，回车键的键位序号为13
                // $('button.search123').trigger("click");//触发搜索按钮的点击事件
                active['reload'] ? active['reload'].call(this) : '';
            }
        });
    });

</script>

</body>
</html>